package com.funny.learning.english.util;

import java.util.regex.Pattern;

import android.text.TextUtils;
import android.util.Patterns;

public class ValidationUtil {

	public static boolean isValidEmail(String email) {
		if (TextUtils.isEmpty(email))
			return false;
		Pattern pattern = Patterns.EMAIL_ADDRESS;
		return pattern.matcher(email).matches();
	}

	public static boolean isValidUserName(String userName) {
		if (TextUtils.isEmpty(userName))
			return false;
		return true;
	}

	public static boolean isValidPwd(String pwd) {
		if (TextUtils.isEmpty(pwd))
			return false;
		return true;
	}

	public static boolean isValidConfirm(String pwd, String confirm) {
		if (TextUtils.isEmpty(pwd) || TextUtils.isEmpty(confirm))
			return false;

		if (pwd.trim().equals(confirm.trim()))
			return true;

		return false;
	}

}
